package com.rams.jhms.gui.datamodels;

import java.util.ArrayList;
import java.util.List;

import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

import com.rams.jhms.dao.DerbyArtistDAO;
import com.rams.jhms.dto.ArtistDTO;

public class ArtistComboBoxModel implements ComboBoxModel {

	private List<ArtistDTO> artists = new ArrayList<ArtistDTO>();
	private ArtistDTO selectedArtist;
	
	public ArtistComboBoxModel() {
		artists = (new DerbyArtistDAO()).getArtistsList();
	}
	
	public int getSize() {
		return artists.size();
	}

	public Object getElementAt(int index) {
		return artists.get(index);
	}

	public void addListDataListener(ListDataListener l) {
		// TODO Auto-generated method stub

	}

	public void removeListDataListener(ListDataListener l) {
		// TODO Auto-generated method stub

	}

	public void setSelectedItem(Object anItem) {
		selectedArtist = (ArtistDTO) anItem;
	}

	public Object getSelectedItem() {
		return selectedArtist;
	}

}
